package demo6;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86183
 */
class A{
    public int a = 10;
}
class B extends A{
    public int a = 20;
}
class C extends B{
    public int a = 30;
    public void func(){
        System.out.println(this.a);//访问当前类(C)的a
        System.out.println(super.a);//访问C类的父类(B)的a
       /* System.out.println(super.super.a);//error*/
    }
}
public class Test2 {
    public static void main(String[] args) {
        C c = new C();
        c.func();
    }
}
